package com.zt.mapper;


import com.zt.pojo.Clazz;
import com.zt.pojo.ClazzQuery;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClazzMapper {
    @Insert("insert into clazz values(#{id},#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void add(Clazz clazz);
    @Select("select * from clazz")
    List<Clazz> findAll();
    List<Clazz> QueryPage(ClazzQuery clazzQuery);
    @Delete("delete from clazz where id = #{id}")
    void deleteById(Integer id);
    @Select("select * from clazz where id = #{id}")
    Clazz findById(Integer id);
    @Update("update clazz set name = #{name}, room = #{room}, begin_date = #{beginDate}, end_date = #{endDate}, master_id = #{masterId},update_time = #{updateTime} where id = #{id} order by update_time")
    void update(Clazz clazz);
    @Select("select count(*) from student where clazz_id = #{id}")
    Integer findStudentByClazzId(Integer id);
}
